<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册</title>
    <link rel="stylesheet" href="../libs/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/denglu.css">
    <script src="../libs/jquery-3.5.1.min.js"></script>
    <script src="../libs/bootstrap/js/bootstrap.min.js"></script>
    
</head>
<body>
    <div class="formbox">  
    <form class="denglu">
        <div class="form-group">
          <label for="exampleInputEmail1">用户名</label>
          <input type="email" class="form-control username" id="exampleInputEmail1" placeholder="请输入用户名">
        </div>
        <div class="form-group">
          <label for="exampleInputPassword1">密码</label>
          <input type="password" class="form-control password" id="exampleInputPassword1" placeholder="请输入密码">
        </div>
        <div class="form-group">
          <label for="exampleInputPassword1">确认密码</label>
          <input type="password" class="form-control consfirmpassword" id="exampleInputPassword1" placeholder="请输入密码">
        </div>
        <button type="submit" class="btn btn-default btn-ok"id='btn-ok'>注册</button>
        <button type="button" class="btn btn-default btn-cencl">登录</button>
      </form>
      <p class="feedback"></p>
    </div>
    <script>
      // class login{
      //   constructor(){
         
      //   }
      // }
      // new login()
     $('.denglu .btn-ok').on('click',function(){
       const name = $('.denglu .username').val()
       const password=$('.denglu .password').val()
       const consfirmpassword=$('.denglu .consfirmpassword').val()
      if(password===consfirmpassword){
        $.get('../api/shop/register.php',{name,password},resp=>{
          console.log(resp)
        },'json')
      }else{
        console.log('两次密码不一致请重新输入')
      }

      })
      $('.denglu .btn-cencl').on('click',function(){
        // location.href='login.html'
        window.open('login.html','_self')
      })  
    </script>
</body>
</html>